import { _decorator, color, Color, Component, Node, size, Sprite, tween, UITransform, Vec2, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('movementControl')
export class movementControl extends Component {
    start() {
       
    // 创建动作
    // const srcTween = tween(this.node)
    // .to(1.0, { position: new Vec3(200, 200, 0)})       
    
    // // to 动作完成后会调用该方法     
    // .call( ()=>{
    //     console.log("call");
    // })
    // .start()
//     let jumpHeight = 100; // 跳跃高度
// let jumpDuration = 1; // 跳跃持续时间
// let jumpCount = 1; // 跳跃次数
// let moveDistance = new Vec3(200, 0); // 水平移动距离
//     tween(this.node)
//     .to(jumpDuration / 2, { position: new Vec3(this.node.position.x + moveDistance.x / 2, this.node.position.y + jumpHeight) })
//     .to(jumpDuration / 2, { position: new Vec3(this.node.position.x + moveDistance.x, this.node.position.y) })
//     .repeat(jumpCount)
//     .start();
let node = this.node
tween(node)
.to(0, { position: new Vec3(100, 100, 0) })
    .parallel(
        tween(node).to(1, { position: new Vec3(0, 0, 0) }),
        tween(node.getComponent(UITransform) as UITransform).to(1, { contentSize: size(100, 100) }),
    	tween(node.getComponent(Sprite) as Sprite).to(1, { color: color(255, 255, 255) }),
    )
    .start();
    }

    update(deltaTime: number) {
        
    }
}


